import com.sun.awt.AWTUtilities;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class MainPanel extends JPanel {

    public MainPanel() {
        super();
        try {
            init();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    private void init() throws Exception {
        JFrame frame = new JFrame("电子图书馆");
        frame.setJMenuBar(XMenuBar.createMenuBar());
        BufferedImage img = ImageIO.read(new File("D:\\code\\swing\\src\\images\\zhifu-yue2.png"));
        frame.setIconImage(img);

        Box vBox = Box.createVerticalBox();
        vBox.setOpaque(false);
        vBox.add(XTable.createTable());

        frame.getContentPane().add(XTable.createTable());
        frame.setSize(800,600);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        AWTUtilities.setWindowOpacity(frame,1F);
        frame.setVisible(true);
    }
}
